var React = require('react');

//
// <AppView viewTitle="视图标题">
//   ...
// </AppView>
//

module.exports = function AppView(props) {
  var hasNav = props.hasNav;
  var classNames = 'pure-view-container';

  if (hasNav === true) {
    classNames = classNames + ' x-view-has-nav';
  }

  return (
    <div className={classNames}>
      {(typeof props.viewTitle === 'string' && props.viewTitle !== '') && (
        <div className="x-view-title">
          {props.viewTitle}
        </div>
      )}
      {props.children}
    </div>
  );
};
